package com.hnhcyy.goods.api;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hnhcyy.b2b.common.util.JsonUtils;
import com.hnhcyy.goods.pojo.SpBal;
import com.hnhcyy.goods.service.SpBalService;

import io.swagger.annotations.Api;

@Api(value="/SpbalApi", tags= "商品库存接口")
@RestController
@RequestMapping("/spbal")
public class SpbalApi {
	
	@Autowired
	private SpBalService spBalService;

	/**
	 * 同步spabl表的数据
	 * @author sheyongjun
	 * @date 2019年1月23日
	 */
	@PostMapping("/update_save")
	public int updateOrSave(@RequestBody String jsonData) {
		List<SpBal> spBalList = JsonUtils.jsonToList(jsonData, SpBal.class);
//		return spBalService.batchUpdateOrInsert(spBalList);
		return spBalService.updateFast(spBalList);
	}

}
